<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>

<script type="text/javascript" charset="utf-8" src="ueditor1_4_3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="ueditor1_4_3/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="ueditor1_4_3/lang/zh-cn/zh-cn.js"></script>
<link rel="stylesheet" href="ueditor1_4_3/themes/default/css/ueditor.css">


<div class="bjui-pageContent">
    <div class="panel panel-default">
        <div class="panel-heading" align="center">编辑新闻信息</div>
        <div class="panel-body">
            <form action="newcollect/submit/update.shtml" class="pageForm" id="addForm"
                  data-toggle="validate" data-callback="doAjaxCallBackForDialog"
                  method="post" data-toggle="ajaxform"
                  data-validator-option="{stopOnError:false, timely:2}">
                <input type="hidden" name="id" id="mark" value="${news.id}">
                <input type="hidden" name="creator" id="creator" value="${news.creator}">
                <input type="hidden" name="uploadTime" value="${news.uploadTime}">
                <table class="table table-condensed table-hover" style="margin-left: 15px;">
                    <tbody>
                    <tr>
                        <td>
                            <label style="width: 80px">标题：</label>
                            <input type="text" name="title" id="title" value="${news.title}" readonly>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label style="width: 80px">类型：</label>
                            <select name="type" id="typeList" data-toggle="selectpicker" data-rule="required;"
                                    data-width="210">
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label style="width: 80px">发布时间：</label>
                            <input type="text" data-toggle="datepicker" data-rule="required;" name="releaseTime"
                                   id="releaseTime" style="width: 210px;" data-pattern="yyyy-MM-dd hh:mm"
                                   data-max-date="%y-%M-%d" value="${news.releaseTime}">
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label style="width: 80px">摄影记者：</label>
                            <input type="text" name="reporterPhoto" id="reporterPhoto" value="${news.reporterPhoto}"
                                   style="width: 420px;">
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label style="width: 80px">文字记者：</label>
                            <input type="text" name="reporterText" id="reporterText" value="${news.reporterText}"
                                   style="width: 420px;">
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <textarea id="newsupdate" name="content"
                                      style="margin-left:20px;">${news.content}</textarea>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </form>
        </div>
    </div>
</div>
<div class="bjui-pageFooter">
    <ul>
        <li>
            <button type="button" class="btn-primary" id="updatesubmit">保存</button>
        </li>
        <li>
            <button type="button" class="btn-close">关闭</button>
        </li>
    </ul>
</div>

<script type="text/javascript">
    var newsupdate = UE.getEditor('newsupdate', {
        toolbars: [
            ['undo', 'redo', '|', 'fontsize', '|', 'blockquote', 'horizontal', '|', 'removeformat', 'formatmatch', 'link', 'unlink', '}', 'simpleupload', 'preview'],
            ['bold', 'italic', 'underline', 'forecolor', 'backcolor', '|', 'indent', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|',
                'rowspacingtop', 'rowspacingbottom', 'lineheight', '|', 'insertorderedlist', 'insertunorderedlist', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter']
        ]
        , autoHeightEnabled: false
        , autoFloatEnabled: true
        , initialFrameWidth: 750//编辑器宽度，默认1000
        , initialFrameHeight: 480//编辑器高度，默认320
        , maximumWords: 1000//最大字符数
    });
    UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
    UE.Editor.prototype.getActionUrl = function (action) {
        if (action == 'uploadimage' || action == 'uploadscrawl' || action == 'uploadimage'
            || action == 'uploadvideo' || action == 'uploadfile') {
            return 'filesupload/ueditor';
        } else {
            return this._bkGetActionUrl.call(this, action);
        }
    };

    $(function () {
        initSelect(false, "#typeList", ${typeList}, false, ${news.type});

        $.CurrentDialog.find("#updatesubmit").on("click", function () {
            $.CurrentDialog.find("form").submit();
        });
    });
</script>
